<template lang="pug">
  .class
    .class-item(
      v-for="item in classes",
      :key="item.tid"
      )
      el-avatar.avatar(:size="50", :src="item.photoUrl")
      router-link(:to="`/tag/${item.tid}`") {{item.tag}}
</template>

<script>
  export default {
    data() {
      return {
        classes: []
      }
    },
    methods: {
      getClasses() {
        this.$http.get('/tags').then(
          res => {
            if(res) {
              this.classes = res.data.data
            }
          }
        )
      }
    },
    created () {
      this.getClasses()
    },
  }
</script>

<style lang="less" scoped>
.class {
  width: 60%;
  margin: 0 auto;
  padding: 20px 20px;
  box-sizing: border-box;
  display: flex;
  flex-flow: row wrap;
  align-content: flex-start;
  justify-content: space-evenly;
  .class-item {
    margin: 20px 20px;
    width: 200px;
    height: 100px;
    border: solid 1px #d0dbe4;
    padding: 10px;
    box-sizing: border-box;
    box-shadow: 0 0 5px #d0dbe4;
    border-radius: 10px;
    line-height: 80px;
    a {
      text-decoration: none;
      color: #409eff;
      &:hover {
        color: #2d91f8;
      }
    }
    .avatar {
      float: left;
      margin-top: 10px;
    }
    &:hover {
      box-shadow: 0 0 10px #d0dbe4;
    }
  }

  @media screen and (max-width: 780px) {
    width: 100%;
    .class-item {
      width: 300px;
    }
  }
}
</style>